< previous page page_99 next page >

Page 99
   lstResource.Clear
   If resourcename = "" Then Exit Sub

   nr.dwType = RESOURCETYPE_DISK
   nr.lpRemoteName = resourcename

   ' Prep the buffer
   OutputBufferSize = 1024
   Do
      ReDim OutputBuffer(OutputBufferSize)
      res = WNetGetResourceInformation(nr, OutputBuffer(0),
            OutputBufferSize, lpSystem)
   Loop While res = ERROR_MORE_DATA
   If res <> 0 Then
      MsgBox "No Resource Information Available"
      Exit Sub
   End If

   ' Get resulting NETRESOURCE
   Call RtlMoveMemory(nr, OutputBuffer(0), Len(nr))

   lstResource.AddItem "Remote Name: " & nr.lpRemoteName
   lstResource.AddItem "Provider: " & nr.lpProvider

End Sub
Results
Everything works fine until you select a mapped drive in the drive selection box. This causes the GetResourceFunction API to be called, leading to an immediate memory exception.
Your challenge: Modify the code to allow you to retrieve the provider information for the network resource.

 
< previous page page_99 next page >